package blue.platform;

import java.io.IOException;
import java.util.ArrayList;

import blue.webserver.WebServer;
import blue.datacenter2.DataCenter;

public class Platform {

	public static void main(String[] args) {
		/* Configuration*/
		ArrayList<String> machine_ip_list = new ArrayList<String>();
		machine_ip_list.add("169.254.1.30");
		machine_ip_list.add("169.254.1.31");
		ArrayList<String> machine_port_list = new ArrayList<String>();
		machine_port_list.add("7600");
		machine_port_list.add("8081");
		machine_port_list.add("8082");
		
		// Port used to pub&sub message from master.
		String master_pub_port = "11001";
		String master_sub_port = "11002";
		// Port used to subscribe message about command flow from master.
		String log_pub_port = "11000";
		String web_port = "8000";
		try{
			// Create Server
			System.out.println("Launch Remote Debug Platform...");
			DataCenter dc_server = new DataCenter(machine_ip_list
					, machine_port_list, master_pub_port, master_sub_port, log_pub_port);
			WebServer web_server = new WebServer(web_port, master_pub_port
					, master_sub_port, log_pub_port);
			// Start Server
			web_server.start_server();
			dc_server.start_server();

			System.out.println("Launch Remote Debug Platform success.");
			
		}catch(IOException e){
			System.out.println(e);
		}catch(Exception e){
			System.out.println(e);
		}

	}

}
